from datetime import date
from python_baway.common.xcommon import xcheck

now = date.today()
print(f'{now!r}')
xcheck(now, 'today')

print(now.strftime('%m-%d-%y %d %b %Y is a %a (%A) on the %d day of %B'))

birthday = date(1983, 1, 30)
age = now - birthday
xcheck(age, 'age')  # datetime.timedelta
print(f'{age.days / 365}')

diff1 = date(2021, 2, 5) - date(2021, 2, 4)
print(repr(diff1), diff1)
diff2 = date(2021, 3, 1) - date(2021, 2, 28)
print(repr(diff2), diff2)
diff3 = date(2021, 2, 27) - date(2021, 2, 28)
print(repr(diff3), diff3)
